﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Controls_ControlMainHomePage : System.Web.UI.UserControl
{
    int i = 0;   
    protected void Page_Load(object sender, EventArgs e)
    {
        string LanguageCode = "vi-vn";
        if (Session["lang"] != null)
            LanguageCode = Session["lang"].ToString();

        List<webapp4U.BOL.Article> obj = webapp4U.BOL.Article.GetAllArticle(1, 100, LanguageCode);
        rptArticle.DataSource = obj;
        rptArticle.DataBind();
    }
    protected void rptArticle_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        var h1 = 0;
        var h2 = 0;
        var h3 = 0;
        try
        {
            i = i + 1;
            if (i == 1)
            {
                //h1 = ((HtmlControl)e.Item.FindControl("div_item_home")).Attributes["hight"];
                ((HyperLink)e.Item.FindControl("LinkImage")).NavigateUrl = webapp4U.Globals.ApplicationPath + "Page/Product/Default.aspx";
                ((HyperLink)e.Item.FindControl("linkDetai")).NavigateUrl = webapp4U.Globals.ApplicationPath + "Page/Product/Default.aspx";
            }
            if (i == 3)
            {
                ((HtmlControl)e.Item.FindControl("div_item_home")).Attributes.Add("style", "margin-right: 0");

                ((HyperLink)e.Item.FindControl("LinkImage")).NavigateUrl = webapp4U.Globals.ApplicationPath + "Page/About/Default.aspx";
                ((HyperLink)e.Item.FindControl("linkDetai")).NavigateUrl = webapp4U.Globals.ApplicationPath + "Page/About/Default.aspx";
            }
        }
        catch { }
    }
}
